export function var_split(param_text: string): Array<string> {
    let outArr = [];
    let prev_type;
    for (let ch of param_text) {
        let current_type;
        if (/[_a-zA-Z]/.test(ch)) {
            current_type = 'str';
        } else {
            current_type = 'no_str';
        }
        if (outArr.length == 0) {
            outArr.push(ch);
        } else {
            if (current_type != prev_type) {
                outArr.push(ch)
            } else {
                outArr[outArr.length - 1] += ch;
            }
        }
        prev_type = current_type;

    }
    return outArr;
}

export function string_function(text: string, func: (p: string) => string): string {
    // const selection = textEditor.selections[0];
    // vscode.Position
    // const text = textEditor.document.getText(selection);

    let text_array = var_split(text);
    text_array = text_array.map(item => func(item));
    let final_text = text_array.join("");
    // edit.replace(selection, final_text);
    return final_text



}